<div class="grid_4">   
    <div class="da-panel">
        <div class="da-panel-header">
            <span class="da-panel-title">
                <img alt="" src="<?php echo $this->themeUrl; ?>/files/theme/images/icons/color/monitor.png">
                File
            </span>
        </div>

        <div id="da-ex-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
            <?php $this->renderPartial('_tabs')?>   

            <div role="grid" class="dataTables_wrapper" id="da-ex-datatable-numberpaging_wrapper">
            <style>
            table.da-table.dataTable tr td{
                vertical-align: top;
            }
            td.button-column a{
                display: block;
                margin-bottom: 10px;
            }
            </style>
                <?php
                    $this->widget('zii.widgets.grid.CGridView', array(
                            'id'=>'item-grid',
                            'dataProvider'=>$model->search(),
                            'filter'=>$model,
                            'template' => "{items}\n{summary}\n{pager}",
                            'summaryCssClass' => 'dataTables_info',
                            'pagerCssClass' => 'dataTables_paginate paging_full_numbers',
                            'itemsCssClass' => 'da-table dataTable',
                            'beforeAjaxUpdate'=>'function(id,options){
                                $("#ajax-loading").fadeIn();    
                            }',
                            'afterAjaxUpdate'=>'function(id,options){
                                $("#ajax-loading").fadeOut();    
                            }',
                            'columns'=>array(
                                array(
                                    'name' => 'id',
                                    'value' => '$data->id',
                                    'filterHtmlOptions' => array('style' => 'width: 30px'),
                                ),
                               array(
                                    'name' => 'image',
                                    'type'      =>  'raw',
                                    'value' => 'CHtml::link(CHtml::image($data->imageUrl, $data->name, array("style" => "width: 60px")), $data->url)',
                                    'filterHtmlOptions' => array('style' => 'width: 60px'),
                                    'filter'=> FALSE,
                                ),
                                array(
                                    'name' => 'name',
                                    'type'      =>  'raw',
                                    'value' => '
                                        CHtml::link($data->name, $data->url)
                                    ',
                                    'filterHtmlOptions' => array('style' => 'width: 150px'),
                                ),
                                array(
                                    'header' => 'Loại',
                                    'name' => 'type',
                                    'value' => '$data->typeLabel',
                                    'type' => 'html',
                                    'filter' => $model->typeData,
                                    'filterHtmlOptions' => array('style' => 'width: 60px'),
                                ),
                                array(
                                    'name' => 'created',
                                    'value' => '$data->created',
                                    'filterHtmlOptions' => array('class' => 'datetimepicker', 'style' => 'width: 75px'),
                                ),
                                array(
                                    'name' => 'manager_id',
                                    'value' => '$data->manager->email',
                                    'type' => 'html',
                                    'filter' => CHtml::listData(Manager::model()->findAll(), 'id', 'email'),
                                    'filterHtmlOptions' => array('style' => 'width: 50px'),
                                ),
                                array(
                                    'class'=>'CButtonColumn',
                                    'template'=>'{view} {update} {delete}',
                                    'buttons' => array(
                                        'view' => array(
                                            'url'=>'$data->url',
                                            'label'=>'Xem file',
                                            'imageUrl'=>$this->themeUrl.'/files/theme/images/icons/color/magnifier.png',
                                        ),
                                        'update' => array(
                                            'url'=>'$data->getAdminUrl("update")',
                                            'label'=>'Sửa file', 
                                            'imageUrl'=>$this->themeUrl.'/files/theme/images/icons/color/pencil.png',
                                        ),
                                        'delete' => array(
                                            'url'=>'$data->getAdminUrl("delete")',
                                            'label'=>'Xóa file',
                                            'imageUrl'=>$this->themeUrl.'/files/theme/images/icons/color/cross.png',
                                        ),
                                    ),
                                ),
                            ),
                        )); ?>             
            </div>

        </div>

    </div>
</div>       

<script>
    $(function(){
            $(".datetimepicker input").live('click focus', function(){
                $(this).datepicker({ dateFormat: 'yy-mm-dd' });
            });

    });   
</script>